package com.trkj.dao.jpa;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.YzrStorehouse;

public interface IYzrStorehouseDAO extends CrudRepository<YzrStorehouse, String> {
	//根据编号前缀查询出最大的编号
	@Query("select max(ss.storeId) from YzrStorehouse ss where ss.storeId like ?1%")
	public String findID(String a);
	
	//查询所有仓库信息
	@Query("select new YzrStorehouse(ss.storeId,ss.storeAddress,ss.storeArea,ss.storeChargeperson,ss.storeKind,ss.storeName) from YzrStorehouse ss order by ss.storeId desc")
	public List<YzrStorehouse> findAll(Pageable pageable);
	
	//根据药房名称模糊查询药房
	@Query("select ss from YzrStorehouse ss where ss.storeName like %?1%")
	public List<YzrStorehouse> findByStoreNameLike(String storeName);
}
